<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8" />
    <script type="application/javascript" th:src="@{/webjars/jquery/3.3.1/jquery.js}"></script>
    <script type="application/javascript" th:src="@{/webjars/bootstrap/3.1.1/js/bootstrap.js}"></script>
    <title></title>
</head>
<script>
    $(function () {
        $("#start").click(function () {
            var name = $('input[id=name]').val()
            var age = $('input[id=age]').val();
            var sex = $('input[id=sex]').val();
            if (name.length == 0 || age.length == 0 || sex.length == 0) {
                alert("请输入完整的信息！");
            } else {
                var param = {
                    'name': name,
                    'age': age,
                    'sex': sex
                };
                $.ajax({
                    type: 'post',
                    dataType: 'json',
                    contentType: 'application/json',
                    url: '/ED_threshold_training/add',
                    data: JSON.stringify(param),
                    success : function(result) {
                        if (result.state == 200) {
                            $("#userId").text("该被试编号为："+ result.results);
                        }
                    }
                });
            }
        });
    });
</script>
<body class="fontstyle">
<div class="bckDiv" >
    <div style="text-align: center">
        <p>为用户绑定编号并生成相应测试实例</p>
        <div class="input">
            <span class="sp" >姓名: </span><input type="text" id="name" />
        </div>
        <div class="input">
            <span class="sp"  >年龄: </span><input type="text" id="age" />
        </div>
        <div class="input">
            <span class="sp"  >性别: </span><input type="text" id="sex" />
        </div>
        <div class="btn">
            <button type="button" class="button" style="size: auto;" id="start">确认</button>
        </div>
    </div>
    <div><span id="userId"></span></div>
</div>
</body>
</html>
